package com.appspot.bibtable.model.format;

import java.io.PrintWriter;

import com.appspot.bibtable.model.Reference;

public class PlainDownloadFormatter extends DownloadFormatter
{
	@Override
	public String getExtension()
	{
		return ".txt";
	}

	@Override
	public void endDownload()
	{
		PrintWriter writer = getWriter();
		writer.flush();
	}

	@Override
	public void endItem(Reference reference, int index)
	{
		PrintWriter writer = getWriter();
		writer.write(format(reference));
		writer.println();
	}

	@Override
	public void startDownload()
	{
	}

	@Override
	public void startItem(Reference reference, int index)
	{
	}

	@Override
	public String format(Reference reference)
	{
		return reference.toString();
	}
}
